<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>后台管理系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

</head>
<body>

    <!-- 右 -->
    <div class="content">
        <div class="header">
            <h1 class="page-title">商品列表</h1>
        </div>

        <div class="well">
            <!-- search button -->
            <form action="/admin/goodsList" method="get" class="form-search">
                <div class="row-fluid" style="text-align: left;">
                    <div class="pull-left span4 unstyled">
                        <p> 商品名称：<input class="input-medium" name="goods_name" value="{$goods_name}" type="text"></p>
                    </div>
                </div>
                <button type="submit" class="btn">查找</button>
                <a class="btn btn-primary" href="/admin/goodsAdd">新增</a>
            </form>
            <button type="button" class="btn batch-del">批量删除</button>
        </div>
        <div class="well">
            <!-- table -->
            <table class="table table-bordered table-hover table-condensed">
                <thead>
                    <tr>
                        <th><input type="checkbox" class="check-all"></th>
                        <th>编号</th>
                        <th>商品名称</th>
                        <th>商品状态</th>
                        <th>商品价格</th>
                        <th>商品数量</th>
                        <th>商品logo</th>
                        <th>添加时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {foreach $data as $key=>$value}
                    <tr class="success">
                        <td><input type="checkbox" class="check-row" data-id="{$value.id}"></td>
                        <td>{$value.id}</td>
<!--                        str_replace(替换的内容，替换成的内容，替换的字符串)-->
                        <td><a href="javascript:void(0);">{:str_replace($goods_name,"<font color='red'>$goods_name</font>",$value.goods_name)}</a></td>
                        <td>{$value.goods_status == 1 ? '上架' : '下架' }</td>
                        <td>{$value.goods_price}</td>
                        <td>{$value.goods_number}</td>
                        <td><img src="{$value.goods_logo}"></td>
                        <td>{$value.create_time}</td>
                        <td>
                            <a href="/admin/goodsEditor/{$value.id}"> 编辑 </a>
                            <a href="javascript:void(0);" onclick="if(confirm('确认删除？')) location.href='/admin/goodsDel?id={$value.id}'"> 删除 </a>
                        </td>
                    </tr>
                    {/foreach}
                </tbody>
            </table>
            <!-- pagination -->
            <div class="pagination">
                {$data|raw}
            </div>
            <hr>
            <div>总记录数：{$data->total()}</div>
            <div>总库存：{$sum}</div>
        </div>
        
        <!-- footer -->
        <footer>
            <hr>
            <p>© 2017 <a href="javascript:void(0);" target="_blank">ADMIN</a></p>
        </footer>
    </div>
</body>
<script type="text/javascript" src="/static/admin/js/goods.js"></script>
</html>